<include file="SpStore:header" />
		<!----《/头部结束》----->
		<div class="ncsc-layout wrapper">
<include file="SpStore:goods_left" />
			<div id="layoutRight" class="ncsc-layout-right">
				<div class="ncsc-path"><i class="icon-desktop"></i>商家管理中心<i class="icon-angle-right"></i>商品<i class="icon-angle-right"></i>商品发布</div>
				<div class="main-content" id="mainContent">
					<!-- S setp -->
					<ul class="add-goods-step">
						<li class="current"><i class="icon icon-list-alt"></i>
							<h6>STEP.1</h6>
							<h2>选择商品分类</h2>
							<i class="arrow icon-angle-right"></i> </li>
						<li><i class="icon icon-edit"></i>
							<h6>STEP.2</h6>
							<h2>填写商品详情</h2>
							<i class="arrow icon-angle-right"></i> </li>
						<li><i class="icon icon-camera-retro "></i>
							<h6>STEP.3</h6>
							<h2>上传商品图片</h2>
							<i class="arrow icon-angle-right"></i> </li>
						<li><i class="icon icon-ok-circle"></i>
							<h6>STEP.4</h6>
							<h2>商品发布成功</h2>
						</li>
					</ul>
					<!--S 分类选择区域-->
					<div class="wrapper_search">
						<div class="wp_sort">
							<div id="dataLoading" class="wp_data_loading">
								<div class="data_loading">加载中...</div>
							</div>
							<div class="sort_selector">
								<div class="sort_title">您常用的商品分类：
									<div class="text" id="commSelect" data-type="1">
										<div id="inSelect">请选择</div>
										<div class="select_list" id="commListArea">
											<ul>
<!-- 												<li><span>数码办公 &gt;手机配件 &gt;蓝牙耳机</span>
												</li>
												<li><span>数码办公</span>
												</li> -->
												<li id="select_list_no" style="display: none;"><span class="title">您还没有添加过常用的分类</span></li>
											</ul>
										</div>
									</div>
									<i class="icon-angle-down"></i>
								</div>
							</div>
							<div id="class_div" class="wp_sort_block">
								<div class="sort_list">
									<div class="wp_category_list">
										<div id="class_div_1" class="category_list ps-container">
											<ul>
												<foreach name="sc_class" item="vo">
												<if condition="$vo.gc_name eq ''">
												<li class=""  data-id="{$vo.gc_id}" data-son="{$vo.son_1_id}" data-son-name="{$vo.son_1}" data-son-name2="{$vo.son_2}" data-son2="{$vo.son_2_id}"> 
													<a class="" href="javascript:void(0)"><i class="icon-double-angle-right"></i>{$vo.name}</a>
												</li>
												<else/>
												<li class="" data-son="" data-id="{$vo.gc_id}" data-jax="{$vo.son_1.0.gc_id}"> 
													<a class="" href="javascript:void(0)"><i class="icon-double-angle-right"></i>{$vo.gc_name}</a>
												</li>
												</if>
												</foreach>
											</ul>
											<div class="ps-scrollbar-x-rail" style="left: 0px; bottom: 3px; width: 284px; display: none;">
												<div class="ps-scrollbar-x" style="left: 0px; width: 0px;"></div>
											</div>
										</div>
									</div>
								</div>
								<div class="sort_list">
									<div class="wp_category_list blank">
										<div id="class_div_2" class="category_list ps-container ">
											<ul>
											
											</ul>
											<div class="ps-scrollbar-x-rail" style="left: 0px; bottom: 3px; width: 15px; display: none;">
												<div class="ps-scrollbar-x" style="left: 0px; width: 0px;"></div>
											</div>
											<div class="ps-scrollbar-y-rail" style="top: 0px; right: 3px; height: 264px; display: none;">
												<div class="ps-scrollbar-y" style="top: 0px; height: 0px;"></div>
											</div>
										</div>
									</div>
								</div>
								<div class="sort_list sort_list_last">
									<div class="wp_category_list blank">
										<div id="class_div_3" class="category_list ps-container">
											<ul>
											</ul>
											<div class="ps-scrollbar-x-rail" style="left: 0px; bottom: 3px; width: 15px; display: none;">
												<div class="ps-scrollbar-x" style="left: 0px; width: 0px;"></div>
											</div>
											<div class="ps-scrollbar-y-rail" style="top: 0px; right: 3px; height: 264px; display: none;">
												<div class="ps-scrollbar-y" style="top: 0px; height: 0px;"></div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="alert">
							<dl class="hover_tips_cont">
								<dt id="commodityspan"><span style="color:#F00;">请选择商品类别</span></dt>
								<dt id="commoditydt" style="display: none;" class="current_sort">您当前选择的商品类别是：</dt>
								<dd id="commoditydd"></dd>
							</dl>
						</div>
						<div class="wp_confirm">
							<form method="get">
								<input type="hidden" name="op" value="add_step_two">
								<input type="hidden" name="class_id" id="class_id" value="">
								<input type="hidden" name="goodsid" id="goodsid" value="{$gid}">
								
								<div class="bottom tc">
									<label class="submit-border"><input id="buttonNextStep" value="下一步，填写商品信息" type="submit" class="submit" style=" width: 200px;"></label>
								</div>
							</form>
						</div>
					</div>
					<script src="__PUBLIC__/Home/js/common_select.js"></script>
					<script src="__PUBLIC__/Home/js/jquery.mousewheel.js"></script>
					<!--<script src="./js/store_goods_add.step1.js"></script>-->


				</div>
			</div>
		</div>
		<script type="text/javascript">
			$("#commListArea").hide();
			
			$("#buttonNextStep").ready(function(){
				var class_id = $("#class_id").val();
				if (class_id) {
					
					$('#areaSelect').attr("disabled",false); 

				} else {
					$('#buttonNextStep').attr("disabled",true); 
				}
				
			});
			$("#commSelect").click(function(){
				$(this).attr('data-type','');
								
				$("#commListArea").show();
				
			});
			
			$("#commListArea ul li").live('click',function(){
				
				var val = $(this).find('span').html();
				$("#commListArea").hide();	
				$("#inSelect").html(val);
		
			});	
            $(document).bind('click', function(e) {  
                var e = e || window.event; //浏览器兼容性   
                var elem = e.target || e.srcElement;  
                while (elem) { //循环判断至跟节点，防止点击的是div子元素   
                    if (elem.id && elem.id == 'commSelect') {  
                        return;  
                    }  
                    elem = elem.parentNode;  
                }  
                $('#commListArea').hide(); //点击的不是div或其子元素   
            }); 		
			$("#class_div_1 ul li").live('click',function(){
				$("#class_div_1 ul li a").removeClass('classDivClick');
				$(this).find('a').addClass('classDivClick');
				var id = $(this).attr('data-son');	
				var name = $(this).attr('data-son-name');	
				var id2 = $(this).attr('data-son2');	
				var name = $(this).attr('data-son-name');
				var name2 = $(this).attr('data-son-name2');
				var class_id = $(this).attr('data-id');
				var jax = $(this).attr('data-jax');
			    id =id.split(',');
				//alert(id[0]);				
				if (id[0]) {
				
					var arr_id =id;
					var arr_name = name.split(',');
					var leng = arr_id.length - 1 ;
					var html = '' ;
					
					var jj = arr_id.length - 2 ;
					
					for(var i=0;i<leng;i++){
					
					    html += '<li data-son="" data-id="'+arr_id[i]+'"><a class="" href="javascript:void(0)"><i class="icon-double-angle-right"></i>'+arr_name[i]+'</a></li>';
						if (i==jj) {
						$("#class_div_2 ul").html(html);
						}
					}
					$("#class_div_2").parent().removeClass('blank');	
				} else if(jax) {
					var url='/store/chackstgrade';	
					
					$.ajax({
						url:url,
						data:{id:class_id,type:"jax_gc"},
						type:'post',
						dataType:'json',
						success:function (e) {
							
							var a = e.info;
							//alert(e.info);
							var html = '';
							if (a) {							
								var jj = a.length - 1 ;
								
								for(var i=0;i<a.length;i++ ) {								
									html += '<li data-son="" data-id="'+a[i].gc_id+'"><a class="" href="javascript:void(0)"><i class="icon-double-angle-right"></i>'+a[i].gc_name+'</a></li>';
									if (i==jj) {
										$("#class_div_2 ul").html(html);
									}
								}
							}
							$("#class_div_2").parent().removeClass('blank');
						}
					});				
				}else {
					$("#class_id").val(class_id);
					$('#buttonNextStep').attr("disabled",false); 
					$("#class_div_2").parent().addClass('blank');
				}				
				
			});
		
			$("#class_div_2 ul li").live('click',function(){
				$("#class_div_2 ul li a").removeClass('classDivClick');
				$(this).find('a').addClass('classDivClick');
				var id = $(this).attr('data-son');	
				var class_id = $(this).attr('data-id');
				
				if (id) {
				
				} else {
					$("#class_id").val(class_id);
					$('#buttonNextStep').attr("disabled",false); 
				}				
				
			});
		
		</script>

		
				<!--底部-->
<include file="SpStore:footer" />

	</body>

</html>